﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditorPassword.aspx.cs" Inherits="sysadmin_UserInfo_EditorPassword" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>修改密码</title>
    <link href="../../css/1/css/css.css" type="text/css" rel="stylesheet" />
</head>
<body class="bodymain">
 <script type="text/javascript" language="javascript">
    var pwd="";
    var flagSubmit=false;
    var flagdbSubmit=false;
    
 
    function showdiv(pw)
    {
    
    pwd=pw.value;
    DIV_checkPWD.innerHTML="";
    var modes=checkStrong(pw.value);
    if(modes==-1)
       DIV_checkPWD.innerHTML="<font color=red><%=GetLanageValueByKey("msg_EditPassword_xgpwd2", PowerCreator.LMS.Language.LanagetItemType.Page)%></font>";
    if(modes==0)
       DIV_checkPWD.innerHTML="<font color=red><%=GetLanageValueByKey("msg_EditPassword_xgpwd3", PowerCreator.LMS.Language.LanagetItemType.Page)%></font>";
    if(modes==1)
       DIV_checkPWD.innerHTML="<table height=12px width=200px><tr><td width=25% bgcolor=red></td><td width=25%></td><td width=25%></td><td width=25%></td></tr></table> <%=GetLanageValueByKey("msg_EditPassword_xgpwd4", PowerCreator.LMS.Language.LanagetItemType.Page)%>";
    if(modes==2)
        {
    flagSubmit=true;
           DIV_checkPWD.innerHTML="<table height=12px width=200px><tr><td width=25% bgcolor=orange></td><td width=25% bgcolor=orange></td><td width=25%></td><td width=25%></td></tr></table><%=GetLanageValueByKey("msg_EditPassword_xgpwd5", PowerCreator.LMS.Language.LanagetItemType.Page)%>";

    }

    if(modes==3)
        {
    flagSubmit=true;
        DIV_checkPWD.innerHTML="<table height=12px width=200px><tr><td width=25% bgcolor=FF9900></td><td width=25% bgcolor=FF9900></td><td width=25% bgcolor=FF9900></td><td width=25%></td></tr></table> <%=GetLanageValueByKey("msg_EditPassword_xgpwd6", PowerCreator.LMS.Language.LanagetItemType.Page)%>";
   }

     if(modes==4)
         {
    flagSubmit=true;
        DIV_checkPWD.innerHTML="<table height=12px width=200px><tr><td width=25% bgcolor=33CC00></td><td width=25%  bgcolor=33CC00></td><td width=25% bgcolor=33CC00></td><td width=25% bgcolor=33CC00></td></tr></table><%=GetLanageValueByKey("msg_EditPassword_xgpwd7", PowerCreator.LMS.Language.LanagetItemType.Page)%>";
   }

   }
    function nocheckdiv()
    {
       DIV_checkPWD.innerHTML="";
 }
 
    function showdbdiv(db)
    {
    if(pwd.length==0)
    {
    DIV_dbPWD.innerHTML="<font color=red><%=GetLanageValueByKey("msg_EditPassword_xgpwd8", PowerCreator.LMS.Language.LanagetItemType.Page)%></font>";
    }
    else
    {
    if(pwd!=db.value)
    {
       DIV_dbPWD.innerHTML="<font color=red> <%=GetLanageValueByKey("msg_EditPassword_xgpwd9", PowerCreator.LMS.Language.LanagetItemType.Page)%></font>";
    }
    else
    {
        flagdbSubmit=true;
        DIV_dbPWD.innerHTML="";
    }
    
    }
   
    
  
   }
    function nocheckdbdiv()
    {
       DIV_dbPWD.innerHTML="";
 }
 
 function checkForm()
 {
 var flag=false;
 if(flagdbSubmit==true& flagSubmit==true)
     flag=true;
 return flag;
 }
 

    </script>
    
    
    <script language=javascript> 
//CharMode函数 
//测试某个字符是属于哪一类. 
function CharMode(iN){ 
if (iN>=48 && iN <=57) //数字 
return 1; 
if (iN>=65 && iN <=90) //大写字母 
return 2; 
if (iN>=97 && iN <=122) //小写 
return 4; 
else 
return 8; //特殊字符 
} 
//bitTotal函数 
//计算出当前密码当中一共有多少种模式 
function bitTotal(num){ 
modes=0; 
for (i=0;i<4;i++){ 
if (num & 1) modes++; 
num>>>=1; 
} 
return modes; 
} 
//checkStrong函数 
//返回密码的强度级别 
function checkStrong(sPW){ 
if (sPW.length<=5) 
return 0; //密码太短 
if (sPW.length>20) 
return -1; //密码太短
Modes=0; 
for (i=0;i<sPW.length;i++){ 
//测试每一个字符的类别并统计一共有多少种模式. 
Modes|=CharMode(sPW.charCodeAt(i));
} 

return bitTotal(Modes); 
} 
//pwStrength函数 
//当用户放开键盘或密码输入框失去焦点时,根据不同的级别显示不同的颜色 
function pwStrength(pwd){ 
O_color="#eeeeee"; 
L_color="#FF0000"; 
M_color="#FF9900"; 
H_color="#33CC00"; 
if (pwd==null||pwd==''){ 
Lcolor=Mcolor=Hcolor=O_color; 
} 
else{ 
S_level=checkStrong(pwd); 
switch(S_level) { 
case 0: 
Lcolor=Mcolor=Hcolor=O_color; 
case 1: 
Lcolor=L_color; 
Mcolor=Hcolor=O_color; 
break; 
case 2: 
Lcolor=Mcolor=M_color; 
Hcolor=O_color; 
break; 
default: 
Lcolor=Mcolor=Hcolor=H_color; 
} 
} 
document.getElementById("strength_L").style.background=Lcolor; 
document.getElementById("strength_M").style.background=Mcolor; 
document.getElementById("strength_H").style.background=Hcolor; 
return; 
} 
</script> 
    <form id="form1" runat="server" >
        <table width="100%" border="0"  cellpadding="0" cellspacing="0" class="tree-titbg_right">
            <tr>
                <td class="tree-titbg_left">
                    <%=GetLanageValueByKey("EditorPassword_desc1", PowerCreator.LMS.Language.LanagetItemType.Page)%>
                </td>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" class="tableList2" width="100%">
            <tr>
                <th>
                    <%=GetLanageValueByKey("EditorPassword_desc11", PowerCreator.LMS.Language.LanagetItemType.Page)%></th>
                <td>
                    <asp:TextBox ID="txt_old_PassWord" runat="server" Width="195px" TextMode="Password"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfv_old_PassWord" runat="server" ErrorMessage="*"
                        ControlToValidate="txt_old_PassWord"></asp:RequiredFieldValidator></td>
            </tr>
            <tr>
                <th>
                    <%=GetLanageValueByKey("EditorPassword_desc12", PowerCreator.LMS.Language.LanagetItemType.Page)%></th>
                <td>
                    <asp:TextBox ID="txt_new_PassWord" runat="server" Width="195px" TextMode="Password"   onfocus="nocheckdiv()" onkeyup="showdiv(this)" onblur="showdiv(this)"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfv_new_PassWord" runat="server" ErrorMessage="*"
                        ControlToValidate="txt_new_PassWord"></asp:RequiredFieldValidator>
                        
                        <div id="DIV_checkPWD">
                    </div>
                    </td>
            </tr>
            <tr>
                <th>
                    <%=GetLanageValueByKey("EditorPassword_desc13", PowerCreator.LMS.Language.LanagetItemType.Page)%></th>
                <td>
                    <asp:TextBox ID="txt_db_PassWord" runat="server" Width="195px" TextMode="Password"  onfocus="nocheckdbdiv()"  onkeyup="showdbdiv(this)"></asp:TextBox>
                    <div id="DIV_dbPWD">
                    </div>
                    </td>
            </tr>
            <tr>
               <td colspan="2" class="tree-bottom-bg">
                    <asp:Button ID="btnSave" runat="server" Text="" CssClass="inputBotton2" OnClick="btnSave_Click" />&nbsp;&nbsp;
                    <asp:Button ID="btnReset" runat="server" Text="" CssClass="inputBotton2" OnClick="btnReset_Click" CausesValidation="False" /></td>
            </tr>
        </table>
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr>
               <td colspan="3">
                    &nbsp;&nbsp;<asp:Label ID="lbl_msg_Error" runat="server" Text="" ForeColor="red"></asp:Label>

            </tr>
        </table>
    </form>
</body>
</html>
